package com.ldc.wandroid.viewmodel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import com.ldc.common.model.BaseModel;
import com.ldc.common.mvvm.ViewModelBase;
import com.ldc.common.net.Api2Request;
import com.ldc.wandroid.model.MyCollectModel;
import com.ldc.wandroid.server.ApiServer;

public class MyCollectViewModel extends ViewModelBase {
    private final ApiServer apiServer;
    private MutableLiveData<BaseModel<MyCollectModel>> collect = new MutableLiveData<>();

    public LiveData<BaseModel<MyCollectModel>> getCollect() {
        return collect;
    }

    public MyCollectViewModel() {
        apiServer = Api2Request.getInstance().createServer(ApiServer.class);
    }


    public void getMyCollectReq(int index) {
        apiRequest(apiServer.getMyCollect(index), (status, result, throwable) -> {
            if (status) {
                collect.setValue(result);
            } else {
                collect.setValue(null);
            }
        });
    }

    public void unSelectCollectReq(String id, String originId) {

    }
}
